/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_Studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#pragma once


#include <future>

#include <core/时间.h>
#include <物体/物体.h>



class C_资源异步加载保存 {

	std::vector<std::thread> threads;
	std::vector<std::function<std::string()>>	m_事件池;

	std::future<std::string>	m_模型加载线程;
	std::condition_variable		m_模型加载等待;
	std::mutex					m_模型加载锁;

	bool						m_运行模型加载;
	std::set<S_物体*>			m_待构建多边形物体;
	std::set<S_物体*>			m_待填充网格物体;
	std::set<S_物体*>			m_待添加物体;


	C_计时 m_计时;

public:
	C_资源异步加载保存(uint32 累计次数 = 200);
	~C_资源异步加载保存();

	void f_添加事件(std::function<std::string()>& event);
	void f_添加加载物体(const std::set<S_物体*>& 待添加物体);
	void f_添加保存物体(const std::set<S_物体*>& 待保存物体);

	bool f_轮询事件();
	void f_打开信息框();

protected:

	void f_构建物体网格();

};






















